﻿using System.Web.UI;
using Medianamik.Core;
using Medianamik.Core.DAL.Repositories;
using Medianamik.UI.Web.Shop.Data;
using Medianamik.UI.Web.Shop.Data.Repositories;
using Medianamik.UI.Web.Shop;
using Medianamik.UI.Web.MVP.Presentation;

namespace Medianamik.UI.Web.Shop.Presentation.Presenters
{
    public class CompanyListPresenter<T, TView> : ModulePresenterWithGrid<T, TView,
                                              ICompanyRepository<T>, INodeTypeRepository, IMedianamikRepository<IMedianamikDTOWithName>> 
        where T : class, ICompany
        where TView : class, ICompanyList
    {
        public CompanyListPresenter(TView view, ICompanyRepository<T> companyRepository,
            INodeTypeRepository nodeTypeRepository, IMedianamikRepository<IMedianamikDTOWithName> baseTypeRepository)
            : base(view, companyRepository, nodeTypeRepository, baseTypeRepository)
        {

        }

        protected override void SetNameColumn(ITextControl control, T element, bool existInCurrentCulture, int childCount)
        {
            control.Text = element.Name;
        }
    }

    public class CompanyListPresenter : CompanyListPresenter<Company, ICompanyList>
    {
        public CompanyListPresenter(ICompanyList view, ICompanyRepository<Company> companyRepository, INodeTypeRepository nodeTypeRepository, IMedianamikRepository<IMedianamikDTOWithName> baseTypeRepository) : base(view, companyRepository, nodeTypeRepository, baseTypeRepository)
        {
        }
    }
}
